package net.zjitc.abstracts.grade;

/**
 * @Author admin
 * @Date 2019/3/22 7:54
 */
public class Undergraduate extends Student{
    public Undergraduate() {
    }

    public Undergraduate(String name) {
        super(name);
        type="本科生";
    }

    @Override
    public void calculateGrade() {
         /* 计算出所有课程的平均分，
        90至100 优秀；80至90良好；70至80中等；60至70及格；60以下不及格*/
        double total=0;
        double average=0;
        for (int i = 0; i <courses.length ; i++) {
            total+=courses[i];
        }
        average=total/courseNo;
        if(average>=90 && average<=100){
            this.courseGrade="优秀";
        }else if(average>=80){
            courseGrade="良好";
        }else if(average>=70){
            courseGrade="中等";
        }else if(average>=60){
            courseGrade="及格";
        }else{
            courseGrade="不及格";
        }
    }
}
